package ee.propaganda.gparrot.client.view;

import java.util.HashMap;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.user.client.ui.RootPanel;

import ee.propaganda.gparrot.client.model.ServiceInfo.ServiceType;
import ee.propaganda.gparrot.client.presenter.ServicesPresenter.Display;

public class MainView implements Display {
	private MainPanel mainPanel;
	
	public MainView(){
		mainPanel = new MainPanel();
	}	

	@Override
	public void setData(HashMap<ServiceType, Boolean> data) {
		mainPanel = new MainPanel();
		RootPanel.get("body").clear();
		mainPanel.setData(data);
		RootPanel.get("body"). add(mainPanel);
		
	}

	@Override
	public void setHeader(String logOutUrl, String email) {
		RootPanel.get("header").clear();
		RootPanel.get("header").add(new HeaderPanel(logOutUrl, email));
	}

	@Override
	public HasClickHandlers getRegisterButton(ServiceType st) {
		return mainPanel.getServicePanel(st).getRegisterButton();
	}

}
